package com.moore.utils;

public class InsertStatementGenerator {

    public static void main(String[] args) {
        for (int i = 6; i <= 100; i++) { // 从6开始到100，共95条数据
            String insertStatement = generateInsertStatement(i);
            System.out.println(insertStatement);
        }
    }

    private static String generateInsertStatement(int id) {
        // 假设其他字段的值也是基于id生成的，你可以根据实际情况修改
        String name = "User" + id;
        String account = "user" + id + "123";
        String password = "password" + id;
        String phone = "123456789" + id;
        String idCard = "ID1234" + (id + 55);
        String address = "Address " + id;
        String status = "active";

        // 生成随机日期，假设在2024年的4月至10月之间
        int month = 4 + (int)(Math.random() * 7);
        int day = 1 + (int)(Math.random() * (getLastDayOfMonth(2024, month) - 1 + 1));
        String createdAt = "2024-" + month + "-" + day;

        return "INSERT INTO `tenant` (`name`, `account`, `password`, `phone`, `id_card`, `address`, `status`, `created_at`) " +
                "VALUES ('" + name + "', '" + account + "', '" + password + "', '" + phone + "', '" + idCard + "', '" + address + "', '" + status + "', '" + createdAt + "');";
    }

    // 辅助方法：获取某个月的天数
    private static int getLastDayOfMonth(int year, int month) {
        // 这里为了简化，不考虑闰年2月的情况，实际使用时可以根据需要添加
        int[] daysInMonth = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
        return daysInMonth[month - 1];
    }
}

